import Vue from 'vue'
import Router from 'vue-router'
import App from '../App'

Vue.use(Router)

const test = () => import('../pages/test')
const home = () => import('../pages/home/home')
const transDetail = () => import('../pages/transDetail/transDetail')
const AcctransDetail = () => import('../pages/transDetail/AcctransDetail')
const BalanceDetail = () => import('../pages/transDetail/BalanceDetail')


const router = new Router({
  routes: [
    {
      path: '/',
      redirect: '/home',
    },
    {
      path: '/test',
      name: 'test',
      component: test,
      meta: {
        keepalive: true,
        name: '测试页面',
      },
    },
    {
      path: '/home',
      name: 'home',
      component: home,
      meta: {
        keepalive: true,
        name: '基础页面',
      },
    },
    {
      path: '/transDetail',
      name: 'transDetail',
      component: transDetail,
      meta: {
        keepalive: false,
        name: '交易详情',
      },
    },
    {
      path: '/AcctransDetail',
      name: 'AcctransDetail',
      component: AcctransDetail,
      meta: {
        keepalive: false,
        name: '转账详情',
      },
    },
    {
      path: '/BalanceDetail',
      name: 'BalanceDetail',
      component: BalanceDetail,
      meta: {
        keepalive: false,
        name: '余额详情',
      },
    },
  ],
})

/*全局导航守卫*/
router.beforeEach((to, from, next) => {

  next()
})

export default router
